package com.liao.quart.entity.from;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.liao.quart.annotate.EntityAno;
import com.liao.quart.entity.PageBaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;

/**
 * 定时任务
 * @TableName sys_quartz_job
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
public class QuartzJobFrom extends PageBaseDto implements Serializable {
    /**
     * ID
     */
    @TableId(type = IdType.AUTO)
    @NotNull(groups = EntityAno.Update.class,message = "id不能为空")
    @NotNull(groups = EntityAno.GetById.class,message = "id不能为空")
    private Long id;

    @NotNull(groups = EntityAno.Mask.class,message = "ids不能为空")
    private Set<Long> ids;
    /**
     * Spring Bean名称
     */
    @NotBlank(message = "Bean名称不能为空")
    private String beanName;

    /**
     * cron 表达式
     */
    @NotBlank(message = "cron表达式不能为空")
    private String cronExpression;

    /**
     * 任务名称
     */
    @NotBlank(message = "任务名称不能为空")
    private String jobName;

    /**
     * 方法名称
     */
    @NotBlank(message = "执行方法不能为空")
    private String methodName;

    /**
     * 参数
     */
    private String params;

    /**
     * 备注
     */
    @NotBlank(message = "备注不能为空")
    private String description;

    /**
     * 负责人
     */
    @NotBlank(message = "负责人不能为空")
    private String personInCharge;

    /**
     * 报警邮箱
     */
    private String email;

    /**
     * 子任务ID
     */
    private String subTask;

    /**
     * 任务失败后是否暂停
     */
    private Boolean pauseAfterFailure;

    /**
     * 1启用/0未启用
     */
    private String isEnable;

    /**
     * 1未删除/0已删除
     */
    private String isDel;

    private String[] createDateRange;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createDateStart;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createDateEnd;
    /**
     * 创建人
     */
    private String createBy;

    /**
     * 创建时间
     */
    private Date createDate;

    /**
     * 更新人
     */
    private String updateBy;

    /**
     * 更新时间
     */
    private Date updateDate;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}